﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using System.IO;

using System.Diagnostics;
using System.Configuration;
using WHC.Hotel.UI.Report;
using WHC.Hotel.BLL;
using WHC.OrderWater.Commons;

namespace WHC.Hotel.UI
{
    public partial class MainForm : Form
    {
        #region 属性字段
        private bool m_bSaveLayout = true;
        private DeserializeDockContent m_deserializeDockContent;

        private MainToolWindow mainToolWin = new MainToolWindow();
        public FrmStatus mainStatus = new FrmStatus();
        private FrmRoomStatusView frmRoomView = new FrmRoomStatusView();
        private FrmKTVSuiteView frmKTVView = new FrmKTVSuiteView();
        private FrmTeaSuiteView frmTeaView = new FrmTeaSuiteView();
        private FrmReport frmReprot = new FrmReport();

        #endregion

        public MainForm()
        {
            InitializeComponent();

            SplashScreen.Splasher.Status = "正在展示相关的内容...";
            System.Threading.Thread.Sleep(100);

            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");
            if (!File.Exists(configFile))
            {
                mainToolWin.Show(this.Menu_RoomAnalysis, DockState.DockLeft);
               // mainStatus.Show(this.dockPanel, DockState.DockLeft);

               
                //if (Portal.gc.HasFunction("KTV/View"))
                //{
                //    frmKTVView.Show(this.dockPanel);
                //}
                //if (Portal.gc.HasFunction("Tea/View"))
                //{
                //    frmTeaView.Show(this.dockPanel);
                //}
                if (Portal.gc.HasFunction("Room/View"))
                {
                    frmRoomView.Show(this.Menu_RoomAnalysis);
                }
                //if (Portal.gc.HasFunction("Report"))
                //{
                //    frmReprot.Show(this.dockPanel);
                //}

                frmRoomView.Focus();

              
            }

            SplashScreen.Splasher.Status = "初始化完毕...";
            System.Threading.Thread.Sleep(50);

            SplashScreen.Splasher.Close();
        }

        private IDockContent GetContentFromPersistString(string persistString)
        {
            if (persistString == typeof(MainToolWindow).ToString())
            {
                return mainToolWin;
            }
            else if (persistString == typeof(FrmStatus).ToString())
            {
                return mainStatus;
            }
            else if (persistString == typeof(FrmRoomStatusView).ToString() 
                && Portal.gc.HasFunction("Room/View"))
            {
                return frmRoomView;
            }
            else if (persistString == typeof(FrmKTVSuiteView).ToString()
                && Portal.gc.HasFunction("KTV/View"))
            {
                return frmKTVView;
            }
            else if (persistString == typeof(FrmTeaSuiteView).ToString()
                && Portal.gc.HasFunction("Tea/View"))
            {
                return frmTeaView;
            }
            else if (persistString == typeof(FrmReport).ToString()
                && Portal.gc.HasFunction("Report"))
            {
                return frmReprot;
            }
            else
            {
                return null;
            }
        }

        #region 子窗口的相关操作

        private DockContent FindDocument(string text)
        {
            if (Menu_RoomAnalysis.DocumentStyle == DocumentStyle.SystemMdi)
            {
                foreach (Form form in MdiChildren)
                {
                    if (form.Text == text)
                    {
                        return form as DockContent;
                    }
                }

                return null;
            }
            else
            {
                foreach (DockContent content in Menu_RoomAnalysis.Documents)
                {
                    if (content.DockHandler.TabText == text)
                    {
                        return content;
                    }
                }

                return null;
            }
        }

        public DockContent ShowContent(string caption, Type formType)
        {
            DockContent frm = FindDocument(caption);
            if (frm == null)
            {
                frm = ChildWinManagement.LoadMdiForm(Portal.gc.MainDialog, formType) as DockContent;
            }

            frm.Show(this.Menu_RoomAnalysis);
            frm.BringToFront();
            return frm;
        }

        public void CloseAllDocuments()
        {
            if (Menu_RoomAnalysis.DocumentStyle == DocumentStyle.SystemMdi)
            {
                foreach (Form form in MdiChildren)
                {
                    form.Close();
                }
            }
            else
            {
                IDockContent[] documents = Menu_RoomAnalysis.DocumentsToArray();
                foreach (IDockContent content in documents)
                {
                    content.DockHandler.Close();
                }
            }
        } 

        #endregion

        private void MainForm_Load(object sender, EventArgs e)
        {
            #region 初始化系统名称
            try
            {
                AppConfig config = new AppConfig();
                string Manufacturer = config.AppConfigGet("Manufacturer");
                string ApplicationName = config.AppConfigGet("ApplicationName");
                string AppWholeName = string.Format("{0}-{1}", Manufacturer, ApplicationName);

                Portal.gc.gAppUnit = Manufacturer;
                Portal.gc.gAppMsgboxTitle = AppWholeName;
                this.Text = AppWholeName;
                this.notifyIcon1.BalloonTipText = AppWholeName;
                this.notifyIcon1.BalloonTipTitle = AppWholeName;
                this.notifyIcon1.Text = AppWholeName;
            }
            catch { } 

            #endregion 

            //加载布局
            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");
            if (File.Exists(configFile))
            {
                Menu_RoomAnalysis.LoadFromXml(configFile, m_deserializeDockContent);
               
            }
            

            Portal.gc.bRegisted = true;
            //this.menu_Help_Register.Visible = true;
            //ValidateRegisterStatus();
            ////Portal.gc.CheckWebRegister();
            //if (!Portal.gc.bRegisted)
            //{
            //}
            //else
            //{
            //}

            InitAuthorizedUI();//根据权限屏蔽
            InitMainFromStatus();//初始化状态栏信息
            if (Portal.gc.LoginInfo.Name.ToLower() != "admin")
            {
                this.menu_DataClear.Enabled = false;
                this.menu_ExecuteSql.Enabled = false;
                this.menu_InitDatabase.Enabled = false;
            }

            //启动夜审服务

            AuditService auditService = new AuditService();
            auditService.start();
        }

        #region 注册信息相关操作

        private void ValidateRegisterStatus()
        {
            //先处理用户的注册信息
            Portal.gc.CheckRegister();

            if (!Portal.gc.bRegisted)
            {
                LogHelper.Info(string.Format("您的机器码：" + Portal.gc.GetHardNumber()));

                if (!Portal.gc.CheckTimeString())
                {
                    RegDlg myRegdlg = RegDlg.Instance();
                    if (myRegdlg.ShowDialog() != DialogResult.OK)
                    {
                        Portal.gc.Quit();
                    }
                }
            }

            if (!Portal.gc.bRegisted)
            {
                Text += " [未注册]";
                menu_Help_Register.Enabled = true; //可注册

                TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - Portal.gc.FirstRunTime.Ticks);
                int canUseDays = UIConstants.SoftwareProbationDay - Math.Abs(ts.Days);
                string daysLeft = string.Format(" [还剩下{0}天]", canUseDays); //提示剩余多少天

                Text += daysLeft;
            }
            else
            {
                Text += " [已注册]";
                menu_Help_Register.Enabled = false; //不能再注册了
            }
        }

        #endregion

        #region 工具栏操作

        private bool ShowToolBar = true;
        private void tool_MainWin_Click(object sender, EventArgs e)
        {
            if (ShowToolBar)
            {
                //this.mainStatus.Hide();
                this.mainToolWin.Hide();
            }
            else
            {
                this.mainToolWin.Show(this.Menu_RoomAnalysis);
               // this.mainStatus.Show(this.dockPanel);
            }
            ShowToolBar = !ShowToolBar;
        }

        public void ShowMainToolWin()
        {
            this.mainToolWin.Show(this.Menu_RoomAnalysis);
        }

        public void ShowMainStatusWin()
        {
            this.mainStatus.Show(this.Menu_RoomAnalysis);
        }

        private void tool_Quit_Click(object sender, EventArgs e)
        {
            if (DialogResult.Yes == MessageUtil.ShowYesNoAndTips("您确定退出此系统么？"))
            {
                this.ShowInTaskbar = false;
                SaveLayout();
                Portal.gc.Quit(); //退出系统
            }
        }

        private void SaveLayout()
        {
            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config");
            if (m_bSaveLayout)
            {
                Menu_RoomAnalysis.SaveAsXml(configFile);
            }
            else if (File.Exists(configFile))
            {
                File.Delete(configFile);
            }
        }

        #endregion

        #region 菜单操作

        #region 系统


        private void menu_System_Password_Click(object sender, EventArgs e)
        {
            FrmModifyPassword dlg = new FrmModifyPassword();
            dlg.ShowDialog();
        }

        private void menu_run_systemLog_Click(object sender, EventArgs e)
        {
            ShowContent("操作人员登录记录", typeof(FrmLogHistroy));
        }

        private void menu_System_Exit_Click(object sender, EventArgs e)
        {
            tool_Quit_Click(null, null);
        }

        private void menu_Window_CloseAll_Click(object sender, EventArgs e)
        {
            CloseAllDocuments();
        }

        private void menu_Window_CloseOther_Click(object sender, EventArgs e)
        {
            if (Menu_RoomAnalysis.DocumentStyle == DocumentStyle.SystemMdi)
            {
                Form activeMdi = ActiveMdiChild;
                foreach (Form form in MdiChildren)
                {
                    if (form != activeMdi)
                    {
                        form.Close();
                    }
                }
            }
            else
            {
                foreach (IDockContent document in Menu_RoomAnalysis.DocumentsToArray())
                {
                    if (!document.DockHandler.IsActivated)
                    {
                        document.DockHandler.Close();
                    }
                }
            }
        }
        #endregion

        #region 基本信息维护

        private void menu_Basic_CustomerArea_Click(object sender, EventArgs e)
        {
            //FrmCustomerArea dlg = new FrmCustomerArea();
            //dlg.ShowDialog();
        }

        private void menu_Basic_CustomerType_Click(object sender, EventArgs e)
        {
            //FrmCustomerType dlg = new FrmCustomerType();
            //dlg.ShowDialog();
        }

        private void menu_Basic_ProductType_Click(object sender, EventArgs e)
        {
            //FrmProductType dlg = new FrmProductType();
            //dlg.ShowDialog();
        }

        private void menu_Basic_Manufacture_Click(object sender, EventArgs e)
        {
            //FrmManufacture dlg = new FrmManufacture();
            //dlg.ShowDialog();
        }

        private void menu_Basic_Deliver_Click(object sender, EventArgs e)
        {
            //FrmDeliver dlg = new FrmDeliver();
            //dlg.ShowDialog();
        }

        private void menu_Basic_LogonUser_Click(object sender, EventArgs e)
        {
            FrmLogonUser dlg = new FrmLogonUser();
            dlg.ShowDialog();
        }

        private void menu_Basic_Shop_Click(object sender, EventArgs e)
        {
            //FrmShop dlg = new FrmShop();
            //dlg.ShowDialog();
        }

        private void menu_Basic_Discount_Click(object sender, EventArgs e)
        {
            //FrmDiscount dlg = new FrmDiscount();
            //dlg.ShowDialog();
        }

        private void menu_Basic_Alarm_Click(object sender, EventArgs e)
        {
            //FrmCustomerAlarm dlg = new FrmCustomerAlarm();
            //dlg.ShowDialog();
        }
         
        private void menu_Basic_SystemMessage_Click(object sender, EventArgs e)
        {
            //FrmSystemMessage dlg = new FrmSystemMessage();
            //dlg.ShowDialog();
        } 
        
        #endregion

        #region 托盘菜单操作

        private void notifyMenu_About_Click(object sender, EventArgs e)
        {
            Portal.gc.About();
        }

        private void notifyMenu_Show_Click(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Minimized)
            {
                this.WindowState = FormWindowState.Maximized;
                this.Show();
                this.BringToFront();
            }
            else
            {
                this.WindowState = FormWindowState.Minimized;
                this.Hide();
            }
        }

        private void notifyMenu_Exit_Click(object sender, EventArgs e)
        {
            SaveLayout();

            try
            {
                this.ShowInTaskbar = false;
                Portal.gc.Quit();
            }
            catch
            {
                // Nothing to do.
            }
        }

        private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            notifyMenu_Show_Click(sender, e);
        }

        private void MainForm_MaximizedBoundsChanged(object sender, EventArgs e)
        {
            this.Hide();
        }

        /// <summary>
        /// 缩小到托盘中，不退出
        /// </summary>
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            e.Cancel = true;
        }

        #endregion 

        #region 辅助工具

        private void menu_Tool_Caculator_Click(object sender, EventArgs e)
        {
            Process.Start("calc.exe");
        }
        private void menu_Tool_Notepad_Click(object sender, EventArgs e)
        {
            Process.Start("notepad.exe");
        }

        private void menu_Tool_Paint_Click(object sender, EventArgs e)
        {
            Process.Start("msPaint.exe");

        } 
        private void menu_Tool_Alipay_Click(object sender, EventArgs e)
        {
            Process.Start("https://www.alipay.com/");
        }
        private void menu_Tool_Taobao_Click(object sender, EventArgs e)
        {
            Process.Start("http://www.taobao.com/");
        }
        #endregion

        #region 数据维护
        private void menu_Data_Export_Click(object sender, EventArgs e)
        {
            //FrmExportData dlg = new FrmExportData();
            //dlg.ShowDialog();
        }

        private void menu_Data_Import_Click(object sender, EventArgs e)
        {
            if (!Portal.gc.bRegisted)
            {
                MessageUtil.ShowWarning("非常抱歉，您不是注册用户，不能使用该功能。");
                return;
            }

            //FrmImportData dlg = new FrmImportData();
            //dlg.ShowDialog();
        }

        private void menu_Sync_Click(object sender, EventArgs e)
        {
            if (!Portal.gc.bRegisted)
            {
                MessageUtil.ShowWarning("非常抱歉，未注册用户不能使用该功能");
                return;
            }
            
            //FrmSync dlg = new FrmSync();
            //dlg.Show();
        }
        #endregion

        #region 帮助
        private void menu_Help_About_Click(object sender, EventArgs e)
        {
            Portal.gc.About();
        }

        private void menu_Help_Help_Click(object sender, EventArgs e)
        {
            Portal.gc.Help();
        }

        private void menu_Help_Register_Click(object sender, EventArgs e)
        {
            Portal.gc.ShowRegDlg();
        }

        private void menu_Help_Bank_Click(object sender, EventArgs e)
        {
           // Process.Start("http://www.iqidi.com/Payment.htm");
        }

        private void menu_Help_Support_Click(object sender, EventArgs e)
        {
            //Process.Start("http://www.iqidi.com/Support.aspx");
        } 
        #endregion

        #endregion

        /// <summary>
        /// 根据权限屏蔽功能
        /// </summary>
        private void InitAuthorizedUI()
        {
            this.tool_RoomView.Enabled = Portal.gc.HasFunction("Room/View");
            this.tool_TeaRoomView.Enabled = Portal.gc.HasFunction("Tea/View");
            this.tool_KTVView.Enabled = Portal.gc.HasFunction("KTV/View");
            this.tool_CustomerManager.Enabled = Portal.gc.HasFunction("Room/Customer");
            this.tool_Goods.Enabled = Portal.gc.HasFunction("Goods");
            this.tool_Report.Enabled = Portal.gc.HasFunction("Report");

            this.menu_Dictionary.Enabled = Portal.gc.HasFunction("Dictionary");
            this.menu_Parameters.Enabled = Portal.gc.HasFunction("Parameters");
            this.menu_Report.Enabled = Portal.gc.HasFunction("Report");
        }

        /// <summary>
        /// 初始化状态栏信息
        /// </summary>
        public void InitMainFromStatus()
        {
            //时间信息
            CCalendar cal = new CCalendar();
            tsslDate.Text = string.Format("当前日期：{0}", cal.GetDateInfo(System.DateTime.Now).Fullinfo);

            //登录信息
            tsslLogin.Text = string.Format("当前用户：{0}({1})",
                Portal.gc.LoginInfo.FullName, Portal.gc.LoginInfo.Name);
        }

        public void RefreshAllForms()
        {
            if (Menu_RoomAnalysis.DocumentStyle == DocumentStyle.SystemMdi)
            {
                foreach (Form form in MdiChildren)
                {
                    BaseForm baseForm = form as BaseForm;
                    if (baseForm != null)
                    {
                        baseForm.RefreshForm();
                        baseForm.Refresh();
                    }
                }
            }
            else
            {
                IDockContent[] documents = Menu_RoomAnalysis.DocumentsToArray();
                foreach (IDockContent content in documents)
                {
                    //content.DockHandler.Close();
                    BaseForm baseForm = content.DockHandler.Form as BaseForm;
                    if (baseForm != null)
                    {
                        baseForm.RefreshForm();
                        baseForm.Refresh();
                    }
                }
            }
        }

        private void timerCurrent_Tick(object sender, EventArgs e)
        {
            tslTime.Text = DateTime.Now.ToLongTimeString();
        }
        
        private void timerRoomStatus_Tick(object sender, EventArgs e)
        {
            //用来处理房间信息的更新（预定过期等）

            //先根据预定过期时间，更新房间的状态

            frmRoomView.ReflashRoomView();
        }

        private void menu_Dictionary_Click(object sender, EventArgs e)
        {
            FrmDictionary dlg = new FrmDictionary();
            dlg.Show();
        }

        #region 工具条管理
        private void tool_RoomView_Click(object sender, EventArgs e)
        {
            ShowContent("客房状态视图", typeof(FrmRoomStatusView));
        }

        private void tool_KTVView_Click(object sender, EventArgs e)
        {
            ShowContent("KTV包间状态视图", typeof(FrmKTVSuiteView));
        }

        private void tool_TeaRoomView_Click(object sender, EventArgs e)
        {
            ShowContent("茶室状态视图", typeof(FrmTeaSuiteView));
        }

        private void tool_CustomerManager_Click(object sender, EventArgs e)
        {
            ShowContent("宾客管理", typeof(FrmCustomer));
        }

        private void tool_Goods_Click(object sender, EventArgs e)
        {
            FrmProductManage dlg = new FrmProductManage();
            dlg.ShowDialog();
        }

        private void tool_Waiter_Click(object sender, EventArgs e)
        {
            ShowContent("服务生管理", typeof(FrmWaiter));
        } 
        #endregion

        private void menu_Parameters_Click(object sender, EventArgs e)
        {
            string SettingsFile = Path.Combine(Application.StartupPath, "SystemConfig.xml");
            GCI.VSP.Framework.Settings.CustomSettings dlg = new GCI.VSP.Framework.Settings.CustomSettings(SettingsFile);
            dlg.ShowForm(GCI.VSP.Framework.Settings.ShowMode.AppRunTime);
        }

        private void menu_Report_Click(object sender, EventArgs e)
        {
            ShowContent("业务报表", typeof(FrmReport));
        }

        private void tool_Report_Click(object sender, EventArgs e)
        {
            ShowContent("业务报表", typeof(FrmReport));
        }

        private void menu_DataClear_Click(object sender, EventArgs e)
        {
            FrmDatabaseClear dlg = new FrmDatabaseClear();
            dlg.ShowDialog();
        }

        private void menu_ExecuteSql_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.InitialDirectory = Application.StartupPath;
            openFileDialog1.Filter = "(*.sql)|*.sql|All files (*.*)|*.*";
            openFileDialog1.FilterIndex = 1;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                //安装Web端权限功能节点
                if (MessageUtil.ShowYesNoAndWarning("本次操作将执行您指定的数据库更新脚本，您是否继续？") == DialogResult.Yes)
                {
                    SqlScriptHelper.DoSQL(openFileDialog1.FileName);
                }
            }
        }

        private void menu_Basic_Security_Click(object sender, EventArgs e)
        {
            WHC.Security.UI.Portal.StartLogin();
        }

        private void menu_InitDatabase_Click(object sender, EventArgs e)
        {
            if (MessageUtil.ShowYesNoAndWarning("您是否确认要初始化系统的数据库？\r\n初始化数据库后，除了一些基本的基础数据外，所有的营业数据将会清除！！\r\n请确认是否进行该操作？") == DialogResult.Yes)
            {
                BLLFactory<Room>.Instance.InitDatabase();
                MessageUtil.ShowTips("数据库已经初始化完成！");
            }
        }

       

        private void ReFlashRoomStatus_Click(object sender, EventArgs e)
        {

            // ShowContent("客房状态视图", typeof(FrmRoomStatusView));
            Form activeMdi = ActiveMdiChild;
            if (activeMdi.Name != "FrmRoomStatusView")
            {


                ShowContent("客房状态视图", typeof(FrmRoomStatusView));

            }

            ((FrmRoomStatusView)ActiveMdiChild).ReflashRoomView();
        }

        private void TSMenuItem_Unit_Click(object sender, EventArgs e)
        {

            ShowContent("协议单位", typeof(FrmProtocolUnitManager));

        }
       

        /// <summary>
        /// 打开房类未来可用表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Menu_RoomStatusAnalysis_Click(object sender, EventArgs e)
        {
            ShowContent("未来房类可用表", typeof(FrmRoomStausAnalysis));
        }

        private void TodayLiveSearchMainMenu_Click(object sender, EventArgs e)
        {
            
           // frmobj.searchType = 1;
          //  frmobj.Show(this.Menu_RoomAnalysis);

            DockContent frm = FindDocument("客人列表");
           
            if (frm!= null)
            {
               // frm = ChildWinManagement.LoadMdiForm(Portal.gc.MainDialog, typeof(FrmCustormerInfoList)) as DockContent;
                frm.Close();
            }

            FrmCustormerInfoList frmobj = new FrmCustormerInfoList();
            frmobj.searchType = 1;
            frmobj.Show(this.Menu_RoomAnalysis);
           

        }

        private void TodayOffSearchMainMenu_Click(object sender, EventArgs e)
        {

            DockContent frm = FindDocument("客人列表");

            if (frm != null)
            {
                // frm = ChildWinManagement.LoadMdiForm(Portal.gc.MainDialog, typeof(FrmCustormerInfoList)) as DockContent;
                frm.Close();
            }
            FrmCustormerInfoList frmobj = new FrmCustormerInfoList();
            frmobj.searchType = 2;
            frmobj.Show(this.Menu_RoomAnalysis);
        }

        private void FastSearchMainMenu_Click(object sender, EventArgs e)
        {

            FrmFastSearch frmobj = new FrmFastSearch();
            if (frmobj.ShowDialog() == DialogResult.OK)
            {

                DockContent frm = FindDocument("客人列表");

                if (frm != null)
                {
                    // frm = ChildWinManagement.LoadMdiForm(Portal.gc.MainDialog, typeof(FrmCustormerInfoList)) as DockContent;
                    frm.Close();
                }
                FrmCustormerInfoList frmSearchobj = new FrmCustormerInfoList();
                frmSearchobj.txtRoomNo.Text = frmobj.txtRoomNo.Text;
                frmSearchobj.txtCardNum.Text = frmobj.txtCardNum.Text;
                frmSearchobj.txtUserName.Text = frmobj.txtUserName.Text;
                frmSearchobj.searchType = 0;
                frmSearchobj.Show(this.Menu_RoomAnalysis);
            
            }


        }

        private void TeamMenu_Click(object sender, EventArgs e)
        {
            ShowContent("团队列表", typeof(FrmCustormerTeamInfoList));
        }

        private void EachBookMenu_Click(object sender, EventArgs e)
        {

            FrmBookRoomNoFixNum obj = new FrmBookRoomNoFixNum();
            obj.ShowDialog();

        }

        private void EachBookManage_Click(object sender, EventArgs e)
        {


            ShowContent("散客预定管理", typeof(FrmBookRoomManager));
        }

        private void TeamBookMenu_Click(object sender, EventArgs e)
        {

            FrmEditTeamBookRoom obj = new FrmEditTeamBookRoom();
            obj.ShowDialog();

        }

        private void TeamBookManage_Click(object sender, EventArgs e)
        {

            ShowContent("团队预定管理", typeof(FrmTeamBookRoomManager));
        }

        private void ConsumeRegister_Click(object sender, EventArgs e)
        {

            FrmSelectRoom obj = new FrmSelectRoom();
            obj.ShowDialog();
             


        }

        /// <summary>
        /// 散客收银
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EachCheckOut_Click(object sender, EventArgs e)
        {


            DockContent frm = FindDocument("客人列表");

            if (frm != null)
            {
                // frm = ChildWinManagement.LoadMdiForm(Portal.gc.MainDialog, typeof(FrmCustormerInfoList)) as DockContent;
                frm.Close();
            }

            FrmCustormerInfoList frmobj = new FrmCustormerInfoList();
            frmobj.searchType = 1;
            frmobj.Show(this.Menu_RoomAnalysis);
           
        }


        /// <summary>
        /// 团队收银
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TeamCheckOut_Click(object sender, EventArgs e)
        {


           // ShowContent("团队列表", typeof(FrmCustormerTeamInfoList));

            DockContent frm = FindDocument("团队列表");

            if (frm != null)
            {
                // frm = ChildWinManagement.LoadMdiForm(Portal.gc.MainDialog, typeof(FrmCustormerInfoList)) as DockContent;
                frm.Close();
            }

            FrmCustormerTeamInfoList frmobj = new FrmCustormerTeamInfoList();
            frmobj.searchType = 1;
            frmobj.Show(this.Menu_RoomAnalysis);


        }

      

    }
}
